import { defineStore } from 'pinia';

export const useSseStore = defineStore('sseData', {
  state: () => ({
    notices: [],
    sseData: null // 新增状态来存储 SSE 数据
  }),
  actions: {
    addNotice(notice) {
      this.notices.push(notice);
    },
    setSSEData(data) {
      this.sseData = data;
    },
    clearData() {
      this.notices = [];
      this.sseData = null;
    }
  }
});
